import time
import requests

url = "https://sportapi.skjpt.com/api/football_inplay_live_new?auth=1&token=d58hBdgGq7dJOMO34jhnBCtOqHzPSkH5i9t6D2bl%2FFGLfZMTYHacToiY2FTPq1uig2%2FYB%2Fv%2FlW4YJTSWGTjupkevwkB%2BA29L20Sl3oRAsBFn0v0YWWXUKvZRHesfHesNkGJruYg1ffK27Yl7TT3hplBR7uPWZZ63kgf1GIJbnFKujGswiNbZlfKVsUBIjea15VBy%2BXZ5Uq439mGgyy3RL%2Ba6OCHERSv22cZUKSieomY%3D&match_id="
def get_record(match_id):
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
    }
    response = requests.get(url + match_id, headers=headers)
    data = response.text
    print(data)

    # 把 data 写入文件
    with open("record.txt", "a") as f:
        f.write(str(data))
        f.write("\n")
    
while True:
    get_record("170843132")
    time.sleep(5)